﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.FileSystem;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Communications;

using CharityGamesOnline.Modules.Common;

namespace CharityGamesOnline.Modules.Game
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    //[WebService(Namespace = "http://tempuri.org/")]
    //[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class SessionHandler : CGOBase, IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            if (!string.IsNullOrEmpty(context.Request["Type"]))
            {
                switch (context.Request["Type"].ToUpper())
                {
                    case "USERID":
                        context.Response.Write(UserId);
                        break;
                    case "USERNAME":
                        context.Response.Write(UserInfo.Username);
                        break;
                    case "PORTALID":
                        context.Response.Write(PortalId);
                        break;
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
